package com.mdd.admin.controller.jiaz.engineer;

import com.mdd.admin.service.jiaz.IEngineerConfigService;
import com.mdd.common.core.AjaxResult;
import com.mdd.common.validate.engineer.EngineerConfigValidate;
import com.mdd.common.vo.engineer.EngineerConfigVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("api/engineer/config")
@Api(tags = "分销设置管理")
public class EngineerConfigController {

    @Resource
    IEngineerConfigService engineerConfigService;

    @GetMapping("/detail")
    @ApiOperation("分销配置详情")
    public AjaxResult<EngineerConfigVo> detail() {
        EngineerConfigVo vo = engineerConfigService.detail();
        return AjaxResult.success(vo);
    }

    @PostMapping("/save")
    @ApiOperation("分销配置保存")
    public AjaxResult<Object> save(@Validated @RequestBody EngineerConfigValidate configValidate) {
        engineerConfigService.save(configValidate);
        return AjaxResult.success();
    }

}
